import 'dart:convert';

import 'package:get/get.dart';
import 'package:largefriends/entity/entities/lf_matchage_entity.dart';
import 'package:largefriends/entity/json/json_parse_utils.dart';
import 'package:largefriends/res/lf_string_ext.dart';

import '../../config/lf_type_config.dart';
import '../../res/lf_int_ext.dart';
import '../../service/lf_auth_service.dart';
import 'lf_location_entity.dart';
import 'lf_photo_entity.dart';

class LfUserEntity {
  LfUserEntity({
    this.about,
    this.age,
    this.agreeGuidelines,
    this.autoRenew,
    this.avatar,
    this.averageScores,
    this.birthday,
    this.body = 0,
    this.blockedMe = 0,
    this.blocked = 0,
    this.canSendVerifyPhoto = 0,
    this.canWink = 0,
    this.changedGender = 0,
    this.changedBirthday = 0,
    this.created,
    this.curLocation,
    this.location,
    this.defaultWinkTypeId,
    this.drink = 0,
    this.education = 0,
    this.email,
    this.emailUnsubscribe,
    this.emailVerified = 0,
    this.ethnicity = 0,
    this.expiredDate,
    this.eyes = 0,
    this.facebookUid,
    this.favoriteMusic = 0,
    this.fraudStatus,
    this.gender = 0,
    this.googleUid,
    this.hair = 0,
    this.hasSubscription,
    this.haveChildren = 0,
    this.headline,
    this.height = 0,
    this.hidden = 0,
    this.hiddenCurrentLocation = 0,
    this.hiddenGender = 0,
    this.hiddenLogin = 0,
    this.hiddenOnline = 0,
    this.hiddenView = 0,
    this.hobby = 0,
    this.hometown,
    this.hp,
    this.ignoreFraudStatus,
    this.income = 0,
    this.language = 0,
    this.lastPayWay,
    this.lastActiveTime,
    this.liked = 0,
    this.likedCntToday,
    this.likedMe = 0,
    this.marital = 0,
    this.matchAbout,
    this.matchAge,
    this.matchedExpired,
    this.matchedExpiredTime,
    this.matchAnywhere,
    this.matchCityId,
    this.matchCountryId,
    this.matchDistance,
    this.matchGender = 3,
    this.matchIncome,
    this.matchAgeMin,
    this.matchAgeMax,
    this.matchRelationship,
    this.matchStateId,
    this.member = 0,
    this.myScores,
    this.noticeLike,
    this.noticeMessage,
    this.noticeView,
    this.occupation = 0,
    this.online = 0,
    this.paymentStartDate,
    this.perfectLikeCnt,
    this.personality,
    this.pet = 0,
    this.phone,
    this.phoneCountry,
    this.phoneVerified,
    this.photos,
    this.politicalBelief = 0,
    this.privateAlbum,
    this.privateAlbumCnt = 0,
    this.profileCommentNumber,
    this.profilePending,
    // this.relation = 0,
    this.religion = 0,
    this.remainingDay,
    this.sign,
    this.smoke = 0,
    this.tlsSig,
    this.totalScorer,
    this.userId,
    this.username = "",
    this.verified = 0,
    this.verifiedIncome = 0,
    this.wantChildren = 0,
    this.winked = 0,
    this.winkedMe = 0,
    this.visitedMeCnt = 0,
    this.photoCnt = 0,
    this.realChat,
    this.roomId,
    this.canAccessMyPrivate = 0,
    this.privateAlbumStatus = 0,
    this.lastMessage = "",
    this.lastMessageSenderId,
    this.messageType = '1',
    this.lastMessageId,
    this.status = 0,
    this.sentMessageStatus = -1,
    this.newNumber = 0,
    this.sentMessageToUserStatus,
    this.isNew = 0,
    this.twoFactorKey,
    this.agreeNoOnlineOnly,
    this.pushedAppsflyerUserId,
    this.backgroundAttachId,
    this.backgroundUrl,
    this.mandatoryVerificationFlag = 0,
  });

  factory LfUserEntity.fromJson(Map<dynamic, dynamic> jsonRes) {
    return LfUserEntity(
      about: jsonRes.asString('about').replaceBreak?.trim() ?? "",
      age: jsonRes.asString('age'),
      agreeGuidelines: jsonRes.asString('agreeGuidelines'),
      autoRenew: jsonRes.asString('autoRenew'),
      avatar: jsonRes.asString('avatar'),
      averageScores: jsonRes.asString('averageScores'),
      birthday: jsonRes.asInt('birthday'),
      body: jsonRes.asInt('body', 0),
      blockedMe: jsonRes.asInt('blockedMe', 0),
      blocked: jsonRes.asInt('blocked', 0),
      canSendVerifyPhoto: jsonRes.asInt('canSendVerifyPhoto'),
      canWink: jsonRes.asInt('canWink'),
      changedGender: jsonRes.asInt('changedGender'),
      changedBirthday: jsonRes.asInt('changedBirthday'),
      created: jsonRes.asString('created'),
      curLocation: jsonRes.asBean('curLocation',
          (json) => LfLocationEntity.fromJson(json as Map<String, dynamic>)),
      defaultWinkTypeId: jsonRes.asString('defaultWinkTypeId'),
      drink: jsonRes.asInt('drink'),
      education: jsonRes.asInt('education'),
      email: jsonRes.asString('email'),
      emailUnsubscribe: jsonRes.asString('emailUnsubscribe'),
      emailVerified: jsonRes.asInt('emailVerified'),
      ethnicity: jsonRes.asInt('ethnicity'),
      expiredDate: jsonRes.asString('expiredDate'),
      eyes: jsonRes.asInt('eyes'),
      facebookUid: jsonRes.asString('facebookUid'),
      favoriteMusic: jsonRes.asInt('favoriteMusic'),
      fraudStatus: jsonRes.asString('fraudStatus'),
      gender: jsonRes.asInt('gender'),
      googleUid: jsonRes.asString('googleUid'),
      hair: jsonRes.asInt('hair'),
      hasSubscription: jsonRes.asBool('hasSubscription'),
      haveChildren: jsonRes.asInt('haveChildren'),
      headline: jsonRes.asString('headline').replaceBreak?.trim() ?? "",
      height: jsonRes.asInt('height'),
      hidden: jsonRes.asInt('hidden'),
      hiddenCurrentLocation: jsonRes.asInt('hiddenCurrentLocation'),
      hiddenGender: jsonRes.asInt('hiddenGender'),
      hiddenLogin: jsonRes.asInt('hiddenLogin'),
      hiddenOnline: jsonRes.asInt('hiddenOnline'),
      hiddenView: jsonRes.asInt('hiddenView'),
      hobby: jsonRes.asInt('hobby'),
      hometown: jsonRes.asString('hometown'),
      hp: jsonRes.asString('hp'),
      ignoreFraudStatus: jsonRes.asString('ignoreFraudStatus'),
      income: jsonRes.asInt('income'),
      language: jsonRes.asInt('language'),
      lastPayWay: jsonRes.asString('lastPayWay'),
      lastActiveTime: jsonRes.asString('lastActiveTime'),
      liked: jsonRes.asInt('liked'),
      likedCntToday: jsonRes.asInt('likedCntToday'),
      likedMe: jsonRes.asInt('likedMe'),
      location: jsonRes.asBean('location',
          (json) => LfLocationEntity.fromJson(json as Map<String, dynamic>)),
      marital: jsonRes.asInt('marital'),
      matchedExpired: jsonRes.asInt('matchedExpired'),
      matchedExpiredTime: jsonRes.asInt('matchedExpiredTime'),
      matchAbout: jsonRes.asString('matchAbout').replaceBreak?.trim() ?? "",
      matchAgeMin: jsonRes.asInt('matchAgeMin', -1),
      matchAgeMax: jsonRes.asInt('matchAgeMax', -1),
      matchAge: jsonRes.asBean('matchAge',
          (json) => LfMatchAgeEntity.fromJson(json as Map<String, dynamic>)),
      matchAnywhere: jsonRes.asString('matchAnywhere'),
      matchCityId: jsonRes.asString('matchCityId'),
      matchCountryId: jsonRes.asString('matchCountryId'),
      matchDistance: jsonRes['matchDistance'] == null
          ? "1"
          : jsonRes.asString('matchDistance') == "2"
              ? "2"
              : "1",

      ///强制是指为1
      matchGender: jsonRes.asInt('matchGender', 3),
      matchIncome: jsonRes.asString('matchIncome'),
      matchRelationship: jsonRes.asString('matchRelationship'),
      matchStateId: jsonRes.asString('matchStateId'),
      member: jsonRes.asInt('member'),
      myScores: jsonRes.asString('myScores'),
      noticeLike: jsonRes.asString('noticeLike'),
      noticeMessage: jsonRes.asString('noticeMessage'),
      noticeView: jsonRes.asString('noticeView'),
      occupation: jsonRes.asInt('occupation'),
      online: jsonRes.asInt('online'),
      paymentStartDate: jsonRes.asInt('paymentStartDate'),
      perfectLikeCnt: jsonRes.asInt('perfectLikeCnt'),
      personality: jsonRes.asString('personality'),
      pet: jsonRes.asInt('pet'),
      phone: jsonRes.asString('phone'),
      phoneCountry: jsonRes.asString('phoneCountry'),
      phoneVerified: jsonRes.asString('phoneVerified'),
      photos: jsonRes.asLists(['photos', 'publicAlbum'],
          (json) => LfPhotoEntity.fromJson(json as Map<String, dynamic>)),
      politicalBelief: jsonRes.asInt('politicalBelief'),
      privateAlbum: jsonRes.asList('privateAlbum',
          (json) => LfPhotoEntity.fromJson(json as Map<String, dynamic>)),
      privateAlbumCnt: jsonRes.asInt('privateAlbumCnt', 0),
      profileCommentNumber: jsonRes.asString('profileCommentNumber'),
      profilePending: jsonRes.asInt('profilePending'),
      // relation: jsonRes.asInt('relation'),
      religion: jsonRes.asInt('religion'),
      remainingDay: jsonRes.asString('remainingDay'),
      sign: jsonRes.asString('sign'),
      smoke: jsonRes.asInt('smoke'),
      tlsSig: jsonRes.asString('tlsSig'),
      totalScorer: jsonRes.asString('totalScorer'),
      userId: jsonRes.asString('userId'),
      username: jsonRes.asString('username'),
      verified: jsonRes.asInt('verified'),
      verifiedIncome: jsonRes.asInt('verifiedIncome'),
      wantChildren: jsonRes.asInt('wantChildren'),
      winked: jsonRes.asInt('winked'),
      visitedMeCnt: jsonRes.asInt('visitedMeCnt', 0),
      lastMessage: jsonRes.asString('lastMessage'),
      lastMessageSenderId: jsonRes.asString('lastMessageSenderId'),
      lastMessageId: jsonRes.asString('lastMessageId'),
      canAccessMyPrivate: jsonRes.asInt('canAccessMyPrivate'),
      privateAlbumStatus: jsonRes.asInt('privateAlbumStatus'),
      messageType: jsonRes.asString('messageType', "1"),
      status: jsonRes.asInt('status', 0),
      sentMessageStatus: jsonRes.asInt('sentMessageStatus', -1),
      newNumber: jsonRes.asInt('newNumber', 0),
      photoCnt: jsonRes.asInt('photoCnt'),
      realChat: jsonRes.asString('realChat'),
      roomId: jsonRes.asString('roomId'),
      sentMessageToUserStatus: jsonRes.asString('sentMessageToUserStatus'),
      winkedMe: jsonRes.asInt('winkedMe'),
      isNew: jsonRes.asInt('isNew'),
      twoFactorKey: jsonRes.asString('twoFactorKey'),
      pushedAppsflyerUserId: jsonRes.asString('pushedAppsflyerUserId'),
      agreeNoOnlineOnly: jsonRes.asString('agreeNoOnlineOnly'),
      backgroundUrl: jsonRes.asString('backgroundUrl'),
      backgroundAttachId: jsonRes.asString('backgroundAttachId'),
      mandatoryVerificationFlag: jsonRes.asInt('mandatoryVerificationFlag'),
    );
  }

  String? about;
  String? age;
  String? agreeGuidelines;
  String? autoRenew;
  String? avatar;
  String? averageScores;
  int? birthday;
  int body;
  int blockedMe;
  int blocked;
  String? lastActiveTime;
  int canSendVerifyPhoto;
  int canWink;
  int changedGender;
  int changedBirthday;
  String? created;
  LfLocationEntity? curLocation;
  String? defaultWinkTypeId;
  int drink;
  int education;
  String? email;
  String? emailUnsubscribe;
  int emailVerified;
  int ethnicity;
  String? expiredDate;
  int eyes;
  String? facebookUid;
  int favoriteMusic;
  String? fraudStatus;
  int gender;
  String? googleUid;
  int hair;
  bool? hasSubscription;
  int haveChildren;
  String? headline;
  int height;
  int hidden;
  int hiddenCurrentLocation;
  int hiddenGender;
  int hiddenLogin;
  int hiddenOnline;
  int hiddenView;
  int hobby;
  String? hometown;
  String? hp;
  String? ignoreFraudStatus;
  int income;
  int language;
  String? lastPayWay;
  int liked;
  int? likedCntToday;
  int likedMe;
  LfLocationEntity? location;
  int marital;
  String? matchAbout;
  LfMatchAgeEntity? matchAge;
  String? matchAnywhere;
  String? matchCityId;
  String? matchCountryId;
  String? matchDistance;
  int matchGender;
  String? matchIncome;
  int? matchAgeMax;
  int? matchAgeMin;
  String? matchRelationship;
  String? matchStateId;
  int member;
  String? myScores;
  String? noticeLike;
  String? noticeMessage;
  String? noticeView;
  int occupation;
  int online;
  int? paymentStartDate;
  int? perfectLikeCnt;
  String? personality;
  int pet;
  String? phone;
  String? phoneCountry;
  String? phoneVerified;
  List<LfPhotoEntity>? photos;
  int politicalBelief;
  List<LfPhotoEntity>? privateAlbum;
  int privateAlbumCnt = 0;
  String? profileCommentNumber;
  int? profilePending;
  // int relation;不要用这个字段,有点混乱了
  int religion;
  String? remainingDay;
  String? sign;
  int smoke;
  String? tlsSig;
  String? totalScorer;
  String? userId;
  String username;
  int verified;
  int verifiedIncome;
  int wantChildren;
  int winked;
  int winkedMe;
  int visitedMeCnt;
  String lastMessage;
  String? lastMessageSenderId;
  String? lastMessageId; //本地数据,防止socket重复发送数据,导致红点计算错误
  int canAccessMyPrivate;

  // 1 - approved/shared, 2 - requested, 3 - rejected, 4 - hidden by uid, 5 - hidden by pid';
  int privateAlbumStatus;
  int? matchedExpired;
  int? matchedExpiredTime;
  int photoCnt;
  String? roomId;
  String? realChat;
  String? sentMessageToUserStatus;
  int isNew;
  String? twoFactorKey;
  String? pushedAppsflyerUserId;
  String? agreeNoOnlineOnly;
  String? backgroundUrl;
  String? backgroundAttachId;
  int mandatoryVerificationFlag;

  // default 1, 1 - text, 2 - image, 3 - radio, 4 - video, 5 - like, 6 - match, 7 - wink,
  //  8 - private album request, 9 - accept private album request, 10 - first date ideas' 11 recall
  //  12, 邀请他人上传照片 ，13 support消息：upgrade送boost;
  String messageType = '1';

  //profile status, 0: pending, 1: approved, 2: refused, 3: blocked, 4: removed, 5: on hold
  int status = 0;

  //未建立连接定义：A发送消息给B，B还未回复A消息的状态  0 ：接收方未回复过消息的状态
  int sentMessageStatus = -1;

  // 未读消息
  int newNumber = -1;

  @override
  String toString() {
    return jsonEncode(this);
  }

  // @override
  // bool operator ==(Object other) =>
  //     identical(this, other) ||
  //     other is UserEntity &&
  //         runtimeType == other.runtimeType &&
  //         userId == other.userId;

  // @override
  // int get hashCode => userId.hashCode;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'about': about,
        'age': age,
        'agreeGuidelines': agreeGuidelines,
        'autoRenew': autoRenew,
        'avatar': avatar,
        'averageScores': averageScores,
        'birthday': birthday,
        'body': body,
        'canSendVerifyPhoto': canSendVerifyPhoto,
        'canWink': canWink,
        'changedGender': changedGender,
        'changedBirthday': changedBirthday,
        'created': created,
        'curLocation': curLocation,
        'defaultWinkTypeId': defaultWinkTypeId,
        'drink': drink,
        'education': education,
        'email': email,
        'emailUnsubscribe': emailUnsubscribe,
        'emailVerified': emailVerified,
        'ethnicity': ethnicity,
        'expiredDate': expiredDate,
        'eyes': eyes,
        'facebookUid': facebookUid,
        'favoriteMusic': favoriteMusic,
        'fraudStatus': fraudStatus,
        'gender': gender,
        'googleUid': googleUid,
        'hair': hair,
        'hasSubscription': hasSubscription,
        'haveChildren': haveChildren,
        'headline': headline,
        'height': height,
        'hidden': hidden,
        'hiddenCurrentLocation': hiddenCurrentLocation,
        'hiddenGender': hiddenGender,
        'hiddenLogin': hiddenLogin,
        'hiddenOnline': hiddenOnline,
        'hiddenView': hiddenView,
        'hobby': hobby,
        'hometown': hometown,
        'hp': hp,
        'ignoreFraudStatus': ignoreFraudStatus,
        'income': income,
        'language': language,
        'lastPayWay': lastPayWay,
        'lastActiveTime': lastActiveTime,
        'liked': liked,
        'likedCntToday': likedCntToday,
        'likedMe': likedMe,
        'location': location,
        'marital': marital,
        'matchedExpired': matchedExpired,
        'matchedExpiredTime': matchedExpiredTime,
        'matchAbout': matchAbout,
        'matchAge': matchAge,
        'matchAnywhere': matchAnywhere,
        'matchCityId': matchCityId,
        'matchCountryId': matchCountryId,
        'matchDistance': matchDistance,
        'matchGender': matchGender,
        'matchIncome': matchIncome,
        'matchAgeMax': matchAgeMax,
        'matchAgeMin': matchAgeMin,
        'matchRelationship': matchRelationship,
        'matchStateId': matchStateId,
        'member': member,
        'myScores': myScores,
        'noticeLike': noticeLike,
        'noticeMessage': noticeMessage,
        'noticeView': noticeView,
        'occupation': occupation,
        'online': online,
        'paymentStartDate': paymentStartDate,
        'perfectLikeCnt': perfectLikeCnt,
        'personality': personality,
        'pet': pet,
        'phone': phone,
        'phoneCountry': phoneCountry,
        'phoneVerified': phoneVerified,
        'photos': photos,
        'politicalBelief': politicalBelief,
        'privateAlbum': privateAlbum,
        'privateAlbumCnt': privateAlbumCnt,
        'profileCommentNumber': profileCommentNumber,
        'profilePending': profilePending,
        // 'relation': relation,
        'religion': religion,
        'remainingDay': remainingDay,
        'sign': sign,
        'smoke': smoke,
        'tlsSig': tlsSig,
        'totalScorer': totalScorer,
        'photoCnt': photoCnt,
        'userId': userId,
        'username': username,
        'verified': verified,
        'wantChildren': wantChildren,
        'verifiedIncome': verifiedIncome,
        'winked': winked,
        'visitedMeCnt': visitedMeCnt,
        'lastMessage': lastMessage,
        'lastMessageSenderId': lastMessageSenderId,
        'lastMessageId': lastMessageId,
        'messageType': messageType,
        'status': status,
        'sentMessageStatus': sentMessageStatus,
        'newNumber': newNumber,
        'canAccessMyPrivate': canAccessMyPrivate,
        'privateAlbumStatus': privateAlbumStatus,
        'blockedMe': blockedMe,
        'blocked': blocked,
        'realChat': realChat,
        'roomId': roomId,
        'sentMessageToUserStatus': sentMessageToUserStatus,
        'winkedMe': winkedMe,
        'isNew': isNew,
        'twoFactorKey': twoFactorKey,
        'pushedAppsflyerUserId': pushedAppsflyerUserId,
        'agreeNoOnlineOnly': agreeNoOnlineOnly,
      };

  /// Only num, String and Uint8List are supported. See https://github.com/tekartik/sqflite/blob/master/sqflite/doc/supported_types.md
  Map<String, dynamic> toJsonForDB() => <String, dynamic>{
        'age': age,
        'avatar': avatar,
        'blockedMe': blockedMe,
        'body': body,
        'canAccessMyPrivate': canAccessMyPrivate,
        'canWink': canWink,
        'created': created,
        'ethnicity': ethnicity,
        'gender': gender,
        'headline': headline,
        'height': height,
        'hidden': hidden,
        'hiddenCurrentLocation': hiddenCurrentLocation,
        'hiddenGender': hiddenGender,
        'lastActiveTime': lastActiveTime,
        'lastMessage': lastMessage,
        'lastMessageSenderId': lastMessageSenderId,
        'lastMessageId': lastMessageId,
        'liked': liked,
        'likedMe': likedMe,
        'marital': marital,
        'matchedExpired': matchedExpired,
        'matchedExpiredTime': matchedExpiredTime,
        'member': member,
        'messageType': messageType,
        'newNumber': newNumber,
        'online': online,
        'photoCnt': photoCnt,
        'realChat': realChat,
        'roomId': roomId,
        'sentMessageStatus': sentMessageStatus,
        'sentMessageToUserStatus': sentMessageToUserStatus,
        'status': status,
        'userId': userId,
        'username': username,
        'verified': verified,
        'winked': winked,
        'winkedMe': winkedMe,
      };

  // String getLocationStr() => location?.toAddress() ?? "";

  String getGenderStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.gender, gender);

  String getGenderAbb() {
    if (gender == 1) {
      return 'W';
    } else if (gender == 2) {
      return 'M';
    }
    return getGenderStr();
  }

  String getInterestStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.hobby, gender);

  String getHeightStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.height, height);

  String getBodyStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.body, body);

  String getDrinkStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.drink, drink);

  String getEducationStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.education, education);

  String getEthnicityStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.ethnicity, ethnicity);

  String getEyeStr() => TypeConfig().getValueByKey(LfConfigTypeEnum.eyes, eyes);

  String getHairStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.hair, hair);

  String getMaritalStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.marital, marital);

  String getSmokeStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.smoke, smoke);

  String getReligionStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.religion, religion);

  String getOccupationStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.occupation, occupation);

  String getHaveChildStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.haveChildren, haveChildren);

  String getWantChildStr() =>
      TypeConfig().getValueByKey(LfConfigTypeEnum.wantChildren, wantChildren);

  String getGpsLocation() {
    ///暂时全部返回currentAddress
    return curLocation?.curAddress ?? '';
  }

  String getLiveIn() {
    if (isHiddenForMe()) {
      return "";
    }
    if (location == null) {
      return '';
    }
    return location!.toAddress();
  }

  String getNameWithGenderAge() {
    List<String> result = List.empty(growable: true);
    result.add(username.toUpperCase());
    if (age != null && age!.isNotEmpty) {
      result.add(age!);
    }
    if (getGenderAbb().isNotEmpty) {
      result.add(getGenderAbb());
    }
    return result.join(', ');
  }

  String geAgeWithGender() {
    if (isHiddenForMe()) {
      return "";
    }
    List<String> result = List.empty(growable: true);
    if (age != null && age!.isNotEmpty) {
      result.add(age!);
    }
    if (getGenderAbb().isNotEmpty) {
      result.add(getGenderAbb());
    }
    return result.join(', ');
  }

  String getGenderWithAgeLiveIn() {
    if (isHiddenForMe()) {
      return "";
    }
    List<String> result = List.empty(growable: true);
    if (age != null && age!.isNotEmpty) {
      result.add(age!);
    }
    if (getGenderAbb().isNotEmpty) {
      result.add(getGenderAbb());
    }
    if (getLiveIn().isNotEmpty) {
      result.add(getLiveIn());
    }
    return result.join(', ');
  }

  bool isVerified() {
    return verified == 1;
  }

  bool isVerifiedIncome() {
    return verifiedIncome == 1;
  }

  bool isGold() {
    // return false;
    return member >= 1;
  }

  int getPhotoCount() {
    return photoCnt ?? 0;
  }

  bool isHiddenGender() {
    return hiddenGender != 0;
  }

  bool isHidden() {
    return hidden != 0;
  }

  bool _isHideOnline() {
    return hiddenOnline == 1 || isHiddenForMe() || isBlockMe();
  }

  bool isOnline() {
    if (isHiddenForMe()) {
      return false;
    }
    if (isBlockMe()) {
      return false;
    }
    if (isEnable() == false) {
      return false;
    }
    return _isHideOnline() == false && (online == 1);
  }

  bool isOnlineRecently() {
    if (isEnable() == false) {
      return false;
    }
    if (isBlockMe()) {
      return false;
    }
    if (isHiddenForMe()) {
      return false;
    }
    return _isHideOnline() == false &&
        (DateTime.now().millisecondsSinceEpoch ~/ 1000 -
                parseInt(lastActiveTime) <
            24 * 60 * 60 * 3);
  }

  bool isEnable() {
    return status <= 1;
  }

  bool isAnonymous() {
    return hiddenView == 1;
  }

  bool isHiddenCurrentLocation() {
    return hiddenCurrentLocation != 0;
  }

  ///只判断hidden 和hidden gender
  bool isHiddenItemOpen() {
    return isHidden() || isHiddenGender();
  }

  bool isCanAccessMyPrivate() {
    return canAccessMyPrivate == 1;
  }

  bool isBlockMe() {
    return blockedMe != 0;
  }

  bool isBlocked() {
    return blocked != 0;
  }

  //对方是否hiden了我
  bool isHiddenForMe() {
    LfAuthService authService = Get.find();
    if (userId == authService.currentAccount!.userId) {
      return false;
    }
    if (hidden == 1) {
      return true;
    }
    if (hidden == 3) {
      //只针对自己喜欢的
      if (likedMe == 1) {
        return false;
      } else {
        return true;
      }
    }

    if (hidden == 4) {
      //只针对自己喜欢的或者对方是会员
      if (likedMe == 1 || authService.currentAccount!.isGold()) {
        return false;
      } else {
        return true;
      }
    }

    if (hiddenGender == 1) {
      if (authService.currentAccount!.gender != 1) {
        return false;
      } else {
        return true;
      }
    }

    if (hiddenGender == 2) {
      if (authService.currentAccount!.gender != 2) {
        return false;
      } else {
        return true;
      }
    }
    return false;
  }

  bool canSharePrivateAlbum() {
    // if (privateAlbum == null || privateAlbum!.isEmpty) {
    //   return false;
    // }
    // bool result = false;
    // for (var element in privateAlbum!) {
    //   if (element.status == 1) {
    //     result = true;
    //     break;
    //   }
    // }
    return false;
  }

  bool isSelf() {
    LfAuthService authService = Get.find();
    return authService.currentAccount?.userId == userId;
  }

  bool isSupport() {
    ///TODO  官网UID
    // if (userId == supportUid) {
    //   return true;
    // }

    if (username.toUpperCase().contains('SUPPORT')) {
      return true;
    }

    ///todo
    if (username.toUpperCase().replaceAll(" ", '').contains('SENIORMATCH')) {
      return true;
    }
    return false;
  }

  List<LfPhotoEntity> privatePhotos() {
    privateAlbum ??= List.empty(growable: true);
    for (var element in privateAlbum!) {
      element.type = photoTypePrivate;
    }
    return privateAlbum!;
  }

  List<LfPhotoEntity> publicPhotos() {
    photos ??= List.empty(growable: true);
    for (var element in photos!) {
      element.type = photoTypePublic;
    }
    return photos!;
  }
}
